<?php
require('lib/verify.php');
require('lib/has_char.php');
require('lib/is_approved.php');
require('lib/is_admin.php');

$_category = "warmath";
$_title = "Admin / Log";
require('lib/head.php');

$n_actions = 500;

$system_id = $system["system_id"];

boxTop("Warmath: $_title");
?>
View the last <?=$n_actions?> actions that have taken place in this Warmath system.
<br /><br />

<table>
<tr>
<th>When</th>
<th>Who</th>
<th>What</th>
<th>How</th>
</tr>
<?php
$sql = "select * from wm_logs left join wm_characters on wm_logs.log_character = wm_characters.character_id where log_system_id=$system_id order by log_datetime desc limit $n_actions";
$result = $db->query($sql);
while($alog = $db->fetch_assoc($result)) {
?>
<tr>
<td><?=date("D d M g:i a", strtotime($alog["log_datetime"]))?></td>
<td><a href="character.php?id=<?=$alog["character_id"]?>"><?=$alog["character_name"]?></a></td>
<td><? if($alog["log_admin"]) {?><b><?}?><?=$alog["log_type"]?><? if($alog["log_admin"]) {?></b><?}?></td>
<td><?=$alog["log_description"]?></td>
</tr>
<?php
    }
?>
</table>
<?php
boxBot();
?>

<?php
require('lib/foot.php');
?>

